package com.lufei.dh.bottom.Bean;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.lufei.dh.R;

import me.drakeet.multitype.ItemViewBinder;

/**
 * 版权：易金卡沃 版权所有
 * <p>
 * 作者：lufei
 * <p>
 * 创建日期：2018/7/10
 * <p>
 * 描述：
 * <p>
 * 修订历史：
 */
public class DiscountViewBinder2 extends ItemViewBinder<Discount, DiscountViewBinder2.ViewHolder> {
    //http://img2.imgtn.bdimg.com/it/u=390562100,1427089938&fm=27&gp=0.jpg

    Context context;

    public DiscountViewBinder2(Context context) {
        this.context = context;
    }
//http://img4.imgtn.bdimg.com/it/u=2682681911,2214217737&fm=27&gp=0.jpg
    @NonNull
    @Override
    protected ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {
        View root = inflater.inflate(R.layout.item_discount2, parent, false);
        return new ViewHolder(root);
    }

    @Override
    protected void onBindViewHolder(@NonNull ViewHolder holder, @NonNull Discount discount) {
//        holder.textView.setText(discount.name);
        Glide.with(context).load(discount.url).into(holder.imageView);
    }

    static class ViewHolder extends RecyclerView.ViewHolder {
//        TextView textView;
        ImageView imageView;

        ViewHolder(View itemView) {
            super(itemView);
//            textView = itemView.findViewById(R.id.id_discount_name);
            imageView = itemView.findViewById(R.id.id_discount2_image);
        }
    }
}
